package com.demoweb.flappy.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.demoweb.model.dao.BoardDao;
import com.demoweb.model.dao.ScoreDao;
import com.demoweb.model.dao.UploadFileDao;
import com.demoweb.model.dto.Board;
import com.demoweb.model.dto.Score;
import com.demoweb.ui.ThePager;

@WebServlet("/flappy/ranking/list.action")
public class RankingListServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		//데이터 조회 (목록 조회)
		ScoreDao dao = new ScoreDao();
		List<Score> scores= dao.getMembersScore(1);
		
		//조회된 목록을 request 객체에 저장
		request.setAttribute("ranking", scores);
		
		//uploadlist.jsp로 forward
		RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/flappy/rank/rankinglist.jsp");

		dispatcher.forward(request, response);
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
